<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>附近云商圈</title>
    <script src="../js/mui.min.js"></script>
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="../css/style.css" />
	<link rel="stylesheet" href="../css/iconfont.css" />
	<link rel="stylesheet" href="../css/sjhout.css" />
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">附近云商圈</h1>
	</header>
	<div class="mui-content recharge_content">
		<ul class="shop_list">
			<!--<li>
				<div class="shop_info clearfix">
					<div class="shop_toux"><img src="../images/toux.jpg"></div>
					<div class="shop_nam">沐口口咖啡小店</div>
				</div>
				<div class="shop_fw clearfix">
					<div class="left">经营范围</div>
					<div class="right">210m</div>
				</div>
				<div class="shop_btnbox">
					<button type="button" class="jus">成员列表</button>
					<button type="button" class="huis">申请加入</button>
				</div>
			</li>-->
		</ul>
		<button type="button" class="alliance_btn" style="display: none;" id='crete_union'>创建联盟</button>
		<button type="button" class="alliance_btn" style="display: none;" id='my_union'>我的联盟</button>
	</div>
</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/picker.js"></script>
<script type="text/javascript" src="../js/city.data-3.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script>
	var member = checkLogin(APP.web_root+"member/login.html");
	$(function(){
		var agent_id = localStorage.getItem('user_agent_id');
		$.ajax({
			url: APP.api_url + 'wallet/union_list_distance',
			data: {
				token: get_token(),
				uid: getUid()
			},
			success: function(data) {
				if(data.code == 200) {
					//检查当前店铺是否联盟成员
					$agent_info = data.data.agent_info;
					if($agent_info['is_union'] == 1){
						$('#crete_union').show();
					}else{
						$('#my_union').show();
					}
					var union_list = data.data.union_list;
					var union_htm='';
					for(var i =0 ;i<union_list.length;i++){
						var jl = union_list[i].juli;
						var unit='m';
						if(jl>1000){
							jl = jl/1000;
							unit = "km";
						}
						var pic = user_tupian(union_list[i].thumb,'../images/toux.jpg');
						
						union_htm ="<li><a href='fujinysq_show.html?union_id="+union_list[i].id+"'>"+
										"<div class='shop_info clearfix'>"+
											"<div class='shop_toux'><img src='"+pic+"'></div>"+
											"<div class='shop_nam'>"+union_list[i].name+"</div>"+
										"</div>"+
										"<div class='shop_fw clearfix'>"+
											"<div class='left'>"+union_list[i].scope+"</div>"+
											"<div class='right'>"+jl+unit+"</div>"+
										"</div>"+

									"</a></li>";
						$('.shop_list').append(union_htm);
					}
				}else{
					$('#my_union').show();
					layer.msg(data.msg);
				}
			}
		});
		$('#crete_union').click(function(){
			location.href = APP.web_root+'shopwallet/fujinysq_edit.html';
		})
		
		$('#my_union').click(function(){
			location.href = APP.web_root+'shopwallet/my_ysq.html';
		})
	})
</script>